package net;

import java.io.IOException;
import java.net.SocketException;
import java.util.HashMap;

/**
 * Creat by TanLei
 * Description:
 * User:86183
 * Date:2022-06-16
 * Time:13:51
 */
public class UdpDictServer extends UdpEchoServer{
    private HashMap<String,String> dict = new HashMap<>();
    public UdpDictServer(int port) throws SocketException {
        super(port);
        dict.put("cat","xaiomao");
        dict.put("dog","xaiogou");
        dict.put("pig","xaiomzu");
    }
    public String process(String req){
        return dict.getOrDefault(req,"没有找到翻译！");
    }

    public static void main(String[] args) throws IOException {
        UdpDictServer udpDictServer = new UdpDictServer(9090);
        udpDictServer.start();
    }
}
